import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:permission_handler/permission_handler.dart';

void showToast(String msg, [Color textColor = Colors.red]) {
  Fluttertoast.showToast(msg: msg, textColor: textColor);
}

void fffBug(msg) {
  debugPrint("---<<<>>>---:${msg}");
}

void dddBug(msg) {
  debugPrint("--->>>>>>>>---:${msg}");
}

/**
 * 请求权限
 */
Future<bool> requesPermission() async {
  await [
    Permission.camera,
    Permission.storage,
  ].request();

  var cameraStatues = await Permission.camera.status;
  var storageStatues = await Permission.storage.status;
  bool b = cameraStatues.isGranted && storageStatues.isGranted;
  return b;
}

String getImageResName(String name) {
  if (name.contains('png') || name.contains('jpg')) {
    return "assets/images/" + name;
  }
  return "assets/images/" + name + ".png";
}
